//
//  XLUnlockSettingCell.m
//  industry
//
//  Created by xl on 2020/12/14.
//  Copyright © 2020 Haier. All rights reserved.
//

#import "XLUnlockSettingCell.h"

@interface XLUnlockSettingCell ()

@property (nonatomic, strong) XLLabel *titleLB;
@property (nonatomic, strong) XLImageView *arrowIG;
@property (nonatomic, strong) XLView *lineView;

@end
@implementation XLUnlockSettingCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self.contentView addSubview:self.titleLB];
        [self.contentView addSubview:self.arrowIG];
        [self.contentView addSubview:self.lineView];
        
        [self makeConstraints];
    }
    return self;
}

- (void)makeConstraints {
    [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(30);
        make.centerY.equalTo(self.contentView);
    }];
    
    [_arrowIG mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-30);
        make.centerY.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(20, 14));
    }];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(30);
        make.right.equalTo(self.contentView).offset(-30);
        make.bottom.equalTo(self.contentView);
        make.height.mas_equalTo(1);
    }];
}

#pragma mark - Public
- (void)loadCellData:(NSString *)title isHidden:(BOOL)isHidden {
    _titleLB.text = title;
    _arrowIG.hidden = isHidden;
}

#pragma mark - Setter/getter
- (XLLabel *)titleLB {
    if (!_titleLB) {
        _titleLB = [XLLabel new];
        _titleLB.font = [UIFont fontOfPingFangSCRegularWithSize:14];
        _titleLB.textColor = [UIColor blackFontColor];
    }
    return _titleLB;
}

- (XLImageView *)arrowIG {
    if (!_arrowIG) {
        _arrowIG = [XLImageView new];
        _arrowIG.image = XLIMAGE(@"lsgx");
    }
    return _arrowIG;
}

- (XLView *)lineView {
    if (!_lineView) {
        _lineView = [XLView new];
        _lineView.backgroundColor = [UIColor graySecondLineColor];
    }
    return _lineView;
}

@end
